package cn.smart.epic.modular.system.controller;

import cn.smart.epic.common.controller.BaseController;
import cn.smart.epic.core.support.HttpKit;
import cn.smart.epic.modular.system.service.ILoginService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 登录控制器
 *
 * @author fengshuonan
 * @Date 2017年1月10日 下午8:25:24
 */
@Api(value = "/login",tags = "登陆模块接口")
@RestController
@RequestMapping(value = "/login/")
public class LoginController extends BaseController {


    @Autowired
    private ILoginService loginService;

    @PostMapping("auth")
    public JSONObject authLogin(@RequestBody JSONObject jsonObject){
        return loginService.authLogin(jsonObject);
    }

    @ApiOperation(value = "获取登陆信息",notes = "获取登陆信息")
    @GetMapping("getInfo")
    public JSONObject getUser(@ApiParam(required = true,name = "token", value = "验证Token") String token){
        return loginService.getInfo();
    }

    @PostMapping("logout")
    public JSONObject logout(){
        HttpKit.getRequestParameters();
        return loginService.logout();
    }

}
